<?php
// se Library\ControllerClass\Controller as EC_Controller;
try {
    $Controller = new Controller();
    $Controller->BootStrap();
    $Controller->SetDirectory(array(
        'default' => HTTP_HOST,
        'crm' => 'crm',
        'api' => 'api'
    ));
//    if ($_SERVER['HTTP_HOST']==\config\ConfigLocal::getLocalConfog()->crm_domain){
    if (HTTP_HOST == 'crm.' . WEB_DOMAIN) {
        $Controller->Param['module'] = 'crm';
    } elseif(HTTP_HOST == 'api.' . WEB_DOMAIN){
        $Controller->Param['module'] = 'api';
    }elseif (HTTP_HOST == 'attach.' . WEB_DOMAIN) {
        $Controller->RouteRegex("AttachIndex", array(
            '\/([photo|file])\/(\d+)',
            array(
                'controller' => 'index'
            ),
            array(
                1 => 'action',
                2 => 'id'
            )
        ));
    } else {
        // 按需添加URL重构路由
    }
    $Controller->SetParam();
    $Controller->run();
    // $Controller->Info();
} catch (Exception $e) {
    die($e->getMessage());
}